home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / nurbsBooleanToolScript.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.4 KB  |  206 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  14 January 1999
  22. // Author:         sw
  23. //
  24. //
  25. //  Procedure Name:
  26. //      nurbsBoolean1ToolScript
  27. //
  28. //  Input Arguments:
  29. //      what is going to happen when this script is called
  30. //        $setToTool = 0 ==> do the command
  31. //        $setToTool = 1 ==> show option box
  32. //        $setToTool = 2 ==> return the command
  33. //        $setToTool = 3 ==> show tool option box
  34. //        $setToTool = 4 ==> enter the tool
  35. //
  36. //  Return Value:
  37. //      None.
  38. //
  39.  
  40. proc createNurbsBooleanContext( int $whichOne, string $tool )
  41. {
  42.     if( ! `licenseCheck -m "edit" -typ "model"` ) return;
  43.  
  44.     switch ($whichOne) {
  45.       case 0:
  46.         if( ! `scriptCtx -exists $tool` ) {
  47.           scriptCtx
  48.             -i1 "nurbsShellUnion.xpm"
  49.             -bcn "nurbsBooleanUnion"
  50.         
  51.             -title "NURBS Boolean Union Tool"
  52.             -toolCursorType  "edit"
  53.             -totalSelectionSets 2
  54.             -cumulativeLists true
  55.             -expandSelectionList true
  56.             -enableRootSelection true 
  57.             -exitUponCompletion true
  58.             -fcs ("performBoolean 0 0 " +
  59.                   "$Selection1 \`currentCtx\`")
  60.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  61.                                    "to form the first object.")
  62.             -setSelectionPrompt ("Select additional surfaces for the " +
  63.                                  "first object or press ENTER to select " +
  64.                                  "the second object.")
  65.  
  66.             -setAutoToggleSelection true
  67.             -setAutoComplete false
  68.             -setSelectionCount 0
  69.             -nurbsSurface true
  70.  
  71.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  72.                                    "to form the second object.")
  73.             -setSelectionPrompt ("Select additional surfaces for the " +
  74.                                  "second object or press ENTER to compute " +
  75.                                  "the boolean union.")
  76.  
  77.             -setAutoToggleSelection true
  78.             -setAutoComplete false
  79.             -setSelectionCount 0
  80.             -nurbsSurface true
  81.             $tool;
  82.         }
  83.         break;
  84.       case 1:
  85.         if( ! `scriptCtx -exists $tool` ) {
  86.           scriptCtx
  87.             -i1 "nurbsShellSubtract.xpm"
  88.             -bcn "nurbsBooleanSubtract"
  89.  
  90.             -title "NURBS Boolean Subtract Tool"
  91.             -toolCursorType  "edit"
  92.             -totalSelectionSets 2
  93.             -cumulativeLists true
  94.             -expandSelectionList true
  95.             -enableRootSelection true 
  96.             -exitUponCompletion true
  97.             -fcs ("performBoolean 0 1 " +
  98.                   "$Selection1 \`currentCtx\`")
  99.  
  100.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  101.                                    "to form the first object.")
  102.             -setSelectionPrompt ("Select additional surfaces for the " +
  103.                                  "first object or press ENTER to select " +
  104.                                  "the second object.")
  105.  
  106.             -setAutoToggleSelection true
  107.             -setAutoComplete false
  108.             -setSelectionCount 0
  109.             -nurbsSurface true
  110.  
  111.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  112.                                    "to form the second object.")
  113.             -setSelectionPrompt ("Select additional surfaces for the " +
  114.                                  "second object or press ENTER to compute " +
  115.                                  "the boolean subtract.")
  116.  
  117.             -setAutoToggleSelection true
  118.             -setAutoComplete false
  119.             -setSelectionCount 0
  120.             -nurbsSurface true
  121.             $tool;
  122.         }
  123.         break;
  124.       case 2:
  125.       default:
  126.         if( ! `scriptCtx -exists $tool` ) {
  127.           scriptCtx
  128.             -i1 "nurbsShellIntersect.xpm"
  129.             -bcn "nurbsBooleanIntersect"
  130.  
  131.             -title "NURBS Boolean Intersect Tool"
  132.             -toolCursorType  "edit"
  133.             -totalSelectionSets 2
  134.             -cumulativeLists true
  135.             -expandSelectionList true
  136.             -enableRootSelection true 
  137.             -exitUponCompletion true
  138.             -fcs ("performBoolean 0 2 " +
  139.                   "$Selection1 \`currentCtx\`")
  140.  
  141.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  142.                                    "to form the first object.")
  143.             -setSelectionPrompt ("Select additional surfaces for the " +
  144.                                  "first object or press ENTER to select " +
  145.                                  "the second object.")
  146.  
  147.             -setAutoToggleSelection true
  148.             -setAutoComplete false
  149.             -setSelectionCount 0
  150.             -nurbsSurface true
  151.  
  152.             -setNoSelectionPrompt ("Select one or more NURBS surfaces " +
  153.                                    "to form the second object.")
  154.             -setSelectionPrompt ("Select additional surfaces for the " +
  155.                                  "second object or press ENTER to compute " +
  156.                                  "the boolean intersect.")
  157.  
  158.             -setAutoToggleSelection true
  159.             -setAutoComplete false
  160.             -setSelectionCount 0
  161.             -nurbsSurface true
  162.             $tool;
  163.         }
  164.         break;
  165.     }
  166. }
  167.  
  168. global proc string nurbsBooleanToolScript( int $setToTool, int $whichOne )
  169. //
  170. //    Description :
  171. //        $setToTool = 0 ==> do the command
  172. //        $setToTool = 1 ==> show option box
  173. //        $setToTool = 2 ==> return the command
  174. //        $setToTool = 3 ==> show tool option box
  175. //        $setToTool = 4 ==> enter the tool
  176. {
  177.     string $tool = "";
  178.     if( $setToTool > 2 ) {
  179.         switch( $whichOne ) {
  180.           case 0:
  181.             $tool = "nurbsBooleanUnionContext";
  182.             break;
  183.           case 1:
  184.             $tool = "nurbsBooleanSubtractContext";
  185.             break;
  186.           case 2:
  187.           default:
  188.             $tool = "nurbsBooleanIntersectContext";
  189.             break;
  190.         }
  191.         createNurbsBooleanContext( $whichOne, $tool );
  192.     }
  193.  
  194.     string $result = "";
  195.     switch ($setToTool) {
  196.       case 4:
  197.         setToolTo $tool;
  198.         break;
  199.       default:
  200.         $result = eval( "performBoolean " + $setToTool + " " +
  201.                         $whichOne + " {\" \", \" \"} \"" + $tool + "\"" );
  202.         break;
  203.     }
  204.     return $result;
  205. }
  206.